//
//  PersonalHeadInfoView.m
//  PigMarket
//
//  Created by mac on 2019/6/13.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "PersonalHeadInfoView.h"

@implementation PersonalHeadInfoView
#pragma mark - init method
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initView];
        [self initLayout];
    }
    return self;
}

- (void)initView {
    // 添加子控件
    [self addSubview:self.headImg];
    [self addSubview:self.nickNameLab];
    [self addSubview:self.addressLab];
}

- (void)initLayout {
    // 布局子控件
    [self.headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(82, 82));
        make.bottom.mas_equalTo(0);
    }];
    [self.nickNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.headImg.mas_right).offset(11);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(28);
        make.top.mas_equalTo(0);
    }];
    
    
}

#pragma mark - getter and setter
- (UIImageView *)headImg {
    if (!_headImg) {
        _headImg = [[UIImageView alloc] init];
        _headImg.layer.cornerRadius = 41;
        _headImg.layer.masksToBounds = YES;
    }
    return _headImg;
}
- (UILabel *)nickNameLab {
    if (!_nickNameLab) {
        _nickNameLab = [[UILabel alloc] init];
        _nickNameLab.textColor = [UIColor whiteColor];
        _nickNameLab.font = [UIFont systemFontOfSize:20];
    }
    return _nickNameLab;
}
- (UIImageView *)identityIcon {
    if (!_identityIcon) {
        _identityIcon = [[UIImageView alloc] init];
        _headImg.layer.cornerRadius = 3;
        _headImg.layer.masksToBounds = YES;
    }
    return _identityIcon;
}
- (UIButton *)addressLab {
    if (!_addressLab) {
        _addressLab = [UIButton buttonWithType:UIButtonTypeCustom];
        [_addressLab setTitleColor:[UIColor colorWithHexString:@"#707070"] forState:UIControlStateNormal];
        _addressLab.titleLabel.font = [UIFont systemFontOfSize:12];
        [_addressLab setImage:[UIImage imageNamed:@"user_location"] forState:UIControlStateNormal];
    }
    return _addressLab;
}
- (UIImageView *)sexIcon {
    if (!_sexIcon) {
        _sexIcon = [[UIImageView alloc] init];
    }
    return _sexIcon;
}
- (UILabel *)personalRemarkLab {
    if (!_personalRemarkLab) {
        _personalRemarkLab = [[UILabel alloc] init];
        _personalRemarkLab.textColor = [UIColor colorWithHexString:@"#707070"];
        _personalRemarkLab.font = [UIFont systemFontOfSize:12];
    }
    return _personalRemarkLab;
}
@end
